<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    var str = "?name=张三&age=19&tmd=王五"
    var str = str.substr(1)
    function xx(){ 
    var num = str.split("&")
    // console.log(str)
    var obj = {}
    num.forEach(function(item){
        var ser = item.split("=")
        obj[ser[0]]= ser[1]
    })
    return obj
    }
    console.log(xx(str))
    </script>
</body>
</html>